﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace UBCon.Ribbon.Models
{
    public sealed class FilterItemModel:INotifyPropertyChanged
    {
        #region Private fields
        private object header;
        private bool isSelected, isAll;
        private RibbonGallery ribbonGallery;
        private double opacity = 1.0D;
        #endregion

        #region Public properties

        public double Opacity 
        {
            get 
            {
                return opacity;
            }
            set 
            {
                opacity = value;
                OnPropertyChanged("Opacity");
            }
        }

        public bool IsAll 
        {
            get 
            {
                return isAll;
            }
            set 
            {
                isAll = value;
            }
        }

        /// <summary>
        /// Gets or sets header of RibbonGallery.
        /// </summary>
        public object Header 
        {
            get 
            {
                return header;
            }
            set 
            {
                if (header != value) 
                {
                    OnPropertyChanged("Header");
                }
                header = value;
            }
        }

        /// <summary>
        /// Gets or sets boolean value indicating whether RibbonGallery is visible;
        /// </summary>
        public bool IsSelected 
        {
            get 
            {
                return isSelected;
            }
            set 
            {
                isSelected = value;
                OnPropertyChanged("IsSelected");
                if (RibbonGallery != null)
                {
                    if (isSelected)
                    {
                        RibbonGallery.Visibility = System.Windows.Visibility.Visible;
                    }
                    else 
                    {
                        RibbonGallery.Visibility = System.Windows.Visibility.Collapsed;
                    }
                }

            }
        }

        /// <summary>
        /// 
        /// </summary>
        public RibbonGallery RibbonGallery 
        {
            get 
            {
                return ribbonGallery;
            }
            set 
            {
                ribbonGallery = value;
            }
        }
        #endregion

        private void OnPropertyChanged(string propertyName) 
        {
            if (PropertyChanged != null) 
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
